const path = require('path');

function resolve(dir = '') {
  return path.join(__dirname, './src', dir);
}
const BASE_API = 'http://www.tiaopiwu.com'  // 转接到本地服务器
console.log(BASE_API,'BASE_API  - vue.config.js');


module.exports = {
  lintOnSave: false,
  productionSourceMap: false,
  devServer: {
    port: 60018,
    proxy: {
      '/api': {
        target: BASE_API,
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      },
      '/zrq-api': {
        target: BASE_API,
        changeOrigin: true,
        pathRewrite: {
          '^/zrq-api': ''
        }
      },
    }
  },
  chainWebpack: config => {
    config.plugins.delete('prefetch');
    config.plugins.delete('preload');
  },
  configureWebpack: {
    resolve: {
      alias: {

      }
    },
    optimization: {
      runtimeChunk: {
        name: entrypoint => `runtime~${entrypoint.name}`
      },
      splitChunks: {
        minChunks: 2,
        minSize: 20000,
        maxAsyncRequests: 20,
        maxInitialRequests: 30,
        name: false
      }
    }
  },
  css: {
    loaderOptions: {
      sass: {
        data: '@import "@/assets/scss/_var.scss";@import "@/assets/scss/_mixin.scss";'
      }
    }
  }
};
